package com.ruoyi.system.mapper;

import com.ruoyi.system.domain.OrderDetail;
import com.ruoyi.system.domain.vo.MetricsQuery;
import com.ruoyi.system.domain.vo.OrderListQuery;
import org.apache.ibatis.annotations.Param;


import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface OrderDetailMapper {
    /**
     * 查询订单详情
     */
    OrderDetail selectOrderDetailById(Integer id);

    /**
     * 查询订单详情列表
     */
    List<OrderDetail> selectOrderDetailList(OrderDetail orderDetail);

    /**
     * 新增订单详情
     */
    int insertOrderDetail(OrderDetail orderDetail);

    /**
     * 修改订单详情
     */
    int updateOrderDetail(OrderDetail orderDetail);
    int updateOrderDetailNew(OrderDetail orderDetail);

    int updateFrom(OrderDetail orderDetail);

    /**
     * 删除订单详情
     */
    int deleteOrderDetailById(Integer id);

    /**
     * 批量删除订单详情
     */
    int deleteOrderDetailByIds(Integer[] ids);

    OrderDetail selectOrderDetailByOrderNumber(String orderNumber);

    /**
     * 根据手机号查询订单列表
     *
     * @param tel 手机号
     * @return 订单列表
     */
    public List<OrderDetail> selectOrderDetailByTel(String tel);

    public List<OrderDetail> selectOrderDetailByToken(String token);

    /**
     * 根据订单号查询订单
     */
    OrderDetail selectOrderDetailByOrderNo(String orderNo);

    /**
     * 更新订单信息
     */

    /**
     * 根据商户订单号查询订单详情
     *
     * @param outTradeNo 商户订单号
     * @return 订单详情
     */
    OrderDetail selectOrderDetailByOutTradeNo(String outTradeNo);

    Integer selectOrderCount(MetricsQuery query);


    Integer selectCompletedOrderCount(MetricsQuery query);

    Integer selectShortLinkKeyCount(MetricsQuery query);

    Integer selectloginH5Count(MetricsQuery query);

    Integer selectLoginShortLinkCount(MetricsQuery query);

    Double selectTransactionAmount(MetricsQuery query);

    Double selectRefundAmount(MetricsQuery query);

    List<Map<String, Object>> selectOrderTypeCount(MetricsQuery query);


    List<Map<String, Object>> selectOrderPayTypeCount(MetricsQuery query);

    void updateAmountById(@Param("payAmount") int payAmount, @Param("amount") BigDecimal amount, @Param("id") Integer id);

    void updateRefundStatusById(@Param("id") Integer id,@Param("refundStatus") String refundStatus,@Param("refundReason") String refundReason);

    List<OrderDetail> selectList(OrderListQuery query);

    List<OrderDetail> orderListLast10();

}
